package io.coderyeah.ymcc.web.controller;

import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import io.coderyeah.ymcc.domain.BlackList;
import io.coderyeah.ymcc.dto.ShieldDTO;
import io.coderyeah.ymcc.result.JSONResult;
import io.coderyeah.ymcc.service.IBlackListService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author lqs
 * @date 2022/10/30 11:39
 */
@RestController
@RequestMapping("/shield")
public class BlackListController {
    @Autowired
    private IBlackListService blackListService;

    /**
     * 拉黑用户
     *
     * @return json
     */
    @PostMapping("/add")
    public JSONResult shield(@RequestBody ShieldDTO shieldDTO) {
        return blackListService.shield(shieldDTO);
    }

    @PostMapping("/list")
    public JSONResult list(@RequestBody ShieldDTO shieldDTO) {
        return blackListService.list(shieldDTO);
    }

    @DeleteMapping("/delete/{id}")
    public JSONResult delete(@PathVariable Long id) {

        return blackListService.delete(id);
    }
}
